package cn.android.common.utils;

/**
 * 单例帮助类
 * @author RenHui
 */
public abstract class SingletonUtils<T> {
	private T instance;
	
	protected abstract T newInstance();  // 抽象方法
	
	public final T getInstance() {
		if (instance == null) {
			synchronized (SingletonUtils.class) {
				if (instance == null) {
					instance = newInstance();
				}
			}
		}
		return instance;
	}
}
